#define __STDC_CONSTANT_MACROS  
 
#include <stdio.h>
#include <stdlib.h>
#include "Utils.h" 
#define WIDTH 1920 
#define HEIGHT 1080
#define VIEO_PIX AV_PIX_FMT_YUV420P      //AV_PIX_FMT_YUV420P

int main(int argc, char **argv)
{
    int ret;
    stYuvBuffInfo YuvBuffInfo;
    YuvBuffInfo.width = 1920;
    YuvBuffInfo.height = 1080;
    YuvBuffInfo.yuvType = TYPE_YUV420SP_NV12;
    //Input YUV  
    FILE * fp_in = fopen("test.yuv","rb+");  
    if(fp_in == NULL)
    {  
        printf("Error open input file.\n");  
        return -1;  
    }  
    //Output YUV  
    FILE * fp_out = fopen("./output.yuv","wb+");  
    if(fp_out == NULL)
    {  
        printf("Error open output file.\n");  
        return -1;  
    } 
    int size = YuvBuffInfo.width * YuvBuffInfo.height * 3 / 2;
    YuvBuffInfo.pYuvBuff =( uint8_t *)malloc(size*sizeof(char)); //最大分配的空间，能满足yuv的各种格式
    fread(YuvBuffInfo.pYuvBuff, size, 1, fp_in);
 
    // Write inference result into image
    stPoint p1;
    p1.x = 500;
    p1.y = 500;
    Utils::YuvDrawText(&YuvBuffInfo, p1, "汽车", YUV_RED);
    
    fwrite(YuvBuffInfo.pYuvBuff, size, 1, fp_out); 
    fclose(fp_in);  
    fclose(fp_out);
    return 0;
 
}
